package com.kangyi.user.mapper;

import com.github.pagehelper.Page;
import com.kangyi.dto.ReviewPageQueryDTO;
import com.kangyi.user.annotation.AutoFill;
import com.kangyi.entity.NursingHomeReview;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.NursingHomeReviewListVO;
import com.kangyi.vo.NursingHomeReviewVO;
import com.kangyi.vo.ReviewPageVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface NursingHomeReviewMapper {

    @Select("SELECT * FROM nursing_home_review WHERE nursing_home_id = #{id}")
    List<NursingHomeReviewVO> inquiryNursingHomeReviews(Integer id);

    List<NursingHomeReviewListVO> listReview(Integer userId);

    @Delete("delete from nursing_home_review where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from nursing_home_review where id = #{id}")
    NursingHomeReview selectById(Integer id);

    @AutoFill(value = OperationType.INSERT)
    void releaseReview(NursingHomeReview nursingHomeReview);

    Page<ReviewPageVO> pageQuery(@Param("queryDTO") ReviewPageQueryDTO reviewPageQueryDTO);
}
